import requests
import re
import json
import time

# res = requests.get("https://datacenter-web.eastmoney.com/api/data/v1/get?callback=datatable8273837&columns=REPORT_DATE%2CTIME%2CDOMESTICL_PRODUCT_BASE%2CFIRST_PRODUCT_BASE%2CSECOND_PRODUCT_BASE%2CTHIRD_PRODUCT_BASE%2CSUM_SAME%2CFIRST_SAME%2CSECOND_SAME%2CTHIRD_SAME&pageNumber=2&pageSize=20&sortColumns=REPORT_DATE&sortTypes=-1&source=WEB&client=WEB&reportName=RPT_ECONOMY_GDP&p=2&pageNo=2&pageNum=2&_=1743647766263")
# content = re.search(r'datatable\d+\((.*?)\);', res.text)
# content = content.group(1)
# content = json.loads(content)
# for item in content["result"]["data"]:
# 	print(item)


# callback 去掉  cb


for page in range(1, 5):
	params = {
		"pageNumber": page,
		"p": page,
		"pageNo": page,
		"pageNum": page,
		"_": f"{int(time.time() * 1000)}"
	}
	res = requests.get(
		"https://datacenter-web.eastm  oney.com/api/data/v1/get?columns=REPORT_DATE%2CTIME%2CDOMESTICL_PRODUCT_BASE%2CFIRST_PRODUCT_BASE%2CSECOND_PRODUCT_BASE%2CTHIRD_PRODUCT_BASE%2CSUM_SAME%2CFIRST_SAME%2CSECOND_SAME%2CTHIRD_SAME&pageSize=20&sortColumns=REPORT_DATE&sortTypes=-1&source=WEB&client=WEB&reportName=RPT_ECONOMY_GDP",
		params=params)
	print(res.json())
	time.sleep(1)